#!/usr/bin/env python3
# -*- coding:utf-8 -*-

import os
import sys

current_dir = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(current_dir)[0]
sys.path.append(rootPath)


# natapp -authtoken 85fc9177674c1254
def restart():
    print('开始重启动主程序')
    commend = 'tasklist|findstr python'
    r = os.popen(commend)
    while 1:
        rr = r.read()
        if rr == '':
            break
        print(rr)
        r_list = rr.replace('   ', '').replace('  ', ' ').replace('\n', ' ').split(' ')
        print(r_list)
        commend = 'taskkill /f /pid ' + r_list[1]
        print(commend)
        r = os.popen(commend)
        print(r.read())
        print('ssss')


if __name__ == "__main__":
    print('')
    restart()
